package edu.hubu.book.service.impl;

import edu.hubu.book.dao.IBookDao;
import edu.hubu.book.domain.Book;
import edu.hubu.book.domain.ExtendBook;
import edu.hubu.book.service.IBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author moonlan
 * date 2020/5/3 11:18
 */
@SuppressWarnings(value = "unused")
@Service
@Transactional
public class BookServiceImpl implements IBookService {
    @Autowired private IBookDao bookDao;

    @Override
    public ExtendBook selectOne(int bid) {
        return bookDao.selectOne(bid);
    }

    @Override
    public List<ExtendBook> selectList() {
        return bookDao.selectList();
    }

    @Override
    public boolean update(int bid, Book newBook) {
        return bookDao.update(bid, newBook) > 0;
    }

    @Override
    public boolean addBook(Book book) {
        return bookDao.addBook(book) > 0;
    }

    @Override
    public boolean delBook(int bid) {
        return bookDao.delBook(bid) > 0;
    }

}
